<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>在线用户</title>
    <link rel="icon" type="image/x-icon" href="./images/wxyy.png"/>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-image: url("images/fengjing.png"); /* 这里的'background.jpg'是图片的路径 */
            background-size: cover; /* 可选，让背景图片覆盖整个元素区域，保持图片比例 */
            background-position: center; /* 可选，设置背景图片的位置 */
            background-repeat: no-repeat; /* 可选，设置背景图片不重复 */
        }


        .login-container h2 {
            margin-bottom: 20px;
            color: #333;
        }

        .form-group {
            margin-bottom: 15px;
        }

        .ccc {
            display: block;
            margin-bottom: 5px;
            color: #666;
        }

        .form-group input {
            width: 70%;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 8px;
            box-sizing: border-box;
        }

        button {
            background-color: #4CAF50;
            color: white;
            border: none;
            padding: 5px 10px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 14px;
            margin: 0 4px;
            cursor: pointer;
            border-radius: 4px;
        }

        button:hover {
            background-color: #0056b3;
        }

        /* 通用样式 */
        /* 表格样式 */
        table {
            width: 60%;
            height: 60%;
            margin: 40px auto;
            border-collapse: collapse;
            background-color: #ffffff;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        th, td {
            text-align: left;
            padding: 12px 15px;
            border-bottom: 1px solid #ddd;
        }

        th {
            background-color: #f2f2f2;
            color: #333;
            font-weight: bold;
        }

        /* 交替行颜色 */
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }

        /* 悬停行效果 */
        tr:hover {
            background-color: #f1f1f1;
        }

        /* 链接样式 */
        a {
            color: #808080;
            text-decoration: none;
        }

        a:hover {
            text-decoration: underline;
        }

        /* 删除链接的样式（可选，用于区分） */
        a.delete {
            color: red;
        }

        a.select {
            color: darkgoldenrod;
        }

        /* 操作列样式 */
        .actions {
            text-align: center;
        }

        /* 响应式设计（可选） */
        @media (max-width: 600px) {
            table, th, td {
                font-size: 14px;
            }

            th, td {
                padding: 8px 10px;
            }
        }

        /*  --------------------------------------------------------  */

        .forms-container {
            display: flex;
            justify-content: space-around;
            padding: 20px;
        }

        .form-box {
            border: 2px solid #0A0A0A;
            border-radius: 8px;
            padding: 20px;
            width: 45%;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-control {
            margin-bottom: 10px;
        }

        .form-control label {
            display: block;
            margin-bottom: 5px;
        }

        .form-control input[type="text"] {
            width: 100%;
            padding: 8px;
            box-sizing: border-box;
            border: 1px solid #ccc;
            border-radius: 4px;
        }

        button[type="submit"] {
            background-color: #0A0A0A;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
        }

        button

    </style>
</head>
<body style="margin: 5px">
<table id="table" border="1" cellspacing="0" width="80%">
    <tr>
        <th>学号</th>
        <th>姓名</th>
        <th>性别</th>
        <th>年龄</th>
        <th>专业</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${userList}" var="user">
        <tr align="center">
                <%--<td>${brand.id}</td>--%>
            <td>${user.sno}</td>
            <td>${user.sname}</td>
            <td>${user.ssex}</td>
            <td>${user.sage}</td>
            <td>${user.sdept}</td>
            <td>
                <a class="delete" href="${pageContext.request.contextPath }/DeleteServlet?Sno=${user.sno}">删除</a>
                <a class="select" href="${pageContext.request.contextPath }/SelectBySnoServlet?Sno=${user.sno}">修改</a>
            </td>
        </tr>
    </c:forEach>
</table>

<div class="forms-container">
    <!-- 查询表单 -->
    <div class="form-box">
        <form class="form-group" action="${pageContext.request.contextPath}/SelectById" method="get">
            <h3>查询</h3>
            <div class="form-control">
                <label for="querySno">Sno:</label>
                <input type="text" id="querySno" name="Sno">
            </div>
            <div class="form-control">
                <label for="querySname">Sname:</label>
                <input type="text" id="querySname" name="Sname">
            </div>
            <div class="form-control">
                <label for="querySsex">Ssex:</label>
                <input type="text" id="querySsex" name="Ssex">
            </div>
            <div class="form-control">
                <label for="querySage">Sage:</label>
                <input type="text" id="querySage" name="Sage">
            </div>
            <div class="form-control">
                <label for="querySdept">Sdept:</label>
                <input type="text" id="querySdept" name="Sdept">
            </div>
            <button type="submit">查询</button>
        </form>
    </div>

    <!-- 新增表单 -->
    <div class="form-box" style="margin-left: 20px">
        <form class="form-group" action="${pageContext.request.contextPath}/AddServlet" method="post">
            <h3>新增</h3>
            <div class="form-control">
                <label for="Sno">Sno:</label>
                <input type="text" id="Sno" name="Sno" required>
            </div>
            <div class="form-control">
                <label for="Sname">Sname:</label>
                <input type="text" id="Sname" name="Sname" required>
            </div>
            <div class="form-control">
                <label for="Ssex">Ssex:</label>
                <input type="text" id="Ssex" name="Ssex" required>
            </div>
            <div class="form-control">
                <label for="Sage">Sage:</label>
                <input type="text" id="Sage" name="Sage" required>
            </div>
            <div class="form-control">
                <label for="Sdept">Sdept:</label>
                <input type="text" id="Sdept" name="Sdept" required>
            </div>
            <button type="submit">新增</button>
        </form>
    </div>
</div>

<%--<div style="float: right">--%>
<%--    &lt;%&ndash;查询&ndash;%&gt;--%>
<%--    <div style="border: #0A0A0A 1em solid">--%>
<%--        <form class="ccc form-group" action="${pageContext.request.contextPath }/SelectById" method="get">--%>
<%--            <div class="form-group">--%>
<%--                Sno：<input type="text" name="Sno"><br>--%>
<%--                Sname：<input type="text" name="Sname"><br>--%>
<%--                Ssex：<input type="text" name="Ssex"><br>--%>
<%--                Sage：<input type="text" name="Sage"><br>--%>
<%--                Sdept：<input type="text" name="Sdept"><br>--%>
<%--                <button type="submit">查询</button>--%>
<%--            </div>--%>
<%--        </form>--%>
<%--    </div>--%>
<%--    &lt;%&ndash;新增&ndash;%&gt;--%>
<%--    <div style="border: #0A0A0A 1em solid">--%>
<%--        <form class="ccc" action="${pageContext.request.contextPath }/AddServlet" method="post">--%>
<%--            <div class="form-group">--%>
<%--                <label for="Sno">Sno:</label>--%>
<%--                <input type="text" id="Sno" name="Sno" required>--%>
<%--            </div>--%>
<%--            <div class="form-group">--%>
<%--                <label for="Sname">Sname:</label>--%>
<%--                <input type="text" id="Sname" name="Sname" required>--%>
<%--            </div>--%>
<%--            <div class="form-group">--%>
<%--                <label for="Ssex">Ssex:</label>--%>
<%--                <input type="text" id="Ssex" name="Ssex" required>--%>
<%--            </div>--%>
<%--            <div class="form-group">--%>
<%--                <label for="Sage">Sage:</label>--%>
<%--                <input type="text" id="Sage" name="Sage" required>--%>
<%--            </div>--%>
<%--            <div class="form-group">--%>
<%--                <label for="Sdept">Sdept:</label>--%>
<%--                <input type="text" id="Sdept" name="Sdept" required>--%>
<%--            </div>--%>
<%--            <button type="submit">新增</button>--%>
<%--        </form>--%>
<%--    </div>--%>
<%--</div>--%>
</body>
</html>